home *** CD-ROM | disk | FTP | other *** search
- Path: Door.lotus.com!verma1
- From: vverma@crd.lotus.com (Virendra Verma)
- Newsgroups: comp.lang.c++
- Subject: Re: problem: static data in classes
- Date: 20 Feb 1996 18:44:47 GMT
- Organization: Lotus Development
- Message-ID: <4gd4qv$kdn@Door.lotus.com>
- References: <9602180123.AA22010@dcc11748.slip.digex.net>
- NNTP-Posting-Host: 130.103.39.48
- X-Newsreader: News Xpress Version 1.0 Beta #3
-
- In article <9602180123.AA22010@dcc11748.slip.digex.net>,
- yami@digex.net (Steven D. Arnold) wrote:
-
- >class sample
- >{
- > public:
- > sample();
- >
- > private:
- > static int count;
- >};
- >
-
- You need to create the definition of sample::count. static members don't get
- created when instanciating a class. By definition, static members have only
- one copy. You need to create that copy separately. Put the following line
- in your .c file
-
- int sample::count = 0
-
-
-